package com.mu.cloud.feign.config;

import com.mu.cloud.feign.util.DozerUtil;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.Collections;
import java.util.List;

@Configuration
@Scope("singleton")
public class DozerConfig {

    @Value("${system.dozerXml}")
    private String configXmlPath;

    @Bean
    public DozerBeanMapper dozer() {
        //这里是配置文件的路径
        List<String> mappingFiles = Collections.singletonList(this.configXmlPath);
        DozerBeanMapper dozerBeanMapper = new DozerBeanMapper();
        dozerBeanMapper.setMappingFiles(mappingFiles);
        DozerUtil dozerUtil=new DozerUtil();
        dozerUtil.setMapper(dozerBeanMapper);
        return dozerBeanMapper;
    }
}